import axios from "axios";

const request = axios.create({
  baseURL: "/api",
  timeout: 20 * 1000,
});

request.interceptors.request.use(
  (config) => {
    return config;
  },
  (error) => {
    console.log(error);
  },
);

request.interceptors.response.use(
  (response) => {
    // 解密
    return response.data;
  },
  (error) => {
    return Promise.reject(error);
  },
);

export default request;
